package dev.ideas.funkyj.tuple;

import dev.ideas.funkyj.sequence.Sequence;

import java.util.Arrays;
import java.util.Iterator;

/**
 */
public abstract class Single<T> extends Tuple<T> {
    public Single() {}
    public abstract T get();

    public static <T1> Single<T1> of(final T1 t1) {
        return new Single<T1>() {
            @Override public T1 get() { return t1; }
        };
    }

    /*@Override*/ public Iterator<T> iterator() {
        return Arrays.asList(get()).iterator();
    }
}
